<?php
error_reporting(7);

class FORMS {

      function formheader($arguments=array()) {

               global $HTTP_SERVER_VARS;
               if ($arguments[enctype]){
                   $enctype="enctype=\"$arguments[enctype]\"";
               } else {
                   $enctype="";
               }
               if (!isset($arguments[method])) {
                   $arguments[method] = "post";
               }
               if (!isset($arguments[action])) {
                   $arguments[action] = $HTTP_SERVER_VARS[PHP_SELF];
               }

               if (!$arguments[colspan]) {
                   $arguments[colspan] = 2;
               }

			   echo "<form action=\"$arguments[action]\" $enctype method=\"$arguments[method]\" name=\"$arguments[name]\" $arguments[extra]>\n";
               echo "<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tableoutline\">\n";
               
               if ($arguments[title]!="") {
                   echo "<tr id=\"cat\">
                          <td class=\"tbhead\" colspan=\"$arguments[colspan]\">
                          <b> $arguments[title] </b>
                          </td>
                         </tr>\n";
               }

      }

      function formfooter($arguments=array()){

               echo "<tr class=\"tbhead\">\n";

               if ($arguments[confirm]==1) {
                   $arguments[button][submit][type] = "submit";
                   $arguments[button][submit][name] = "submit";
                  if($arguments[name]!='search'){$arguments[button][submit][value] = "Save";}else{$arguments[button][submit][value] = "Search";}
                   $arguments[button][submit][accesskey] = "y";
                  if($arguments[name]!='search'){
                   $arguments[button][back][type] = "button";
                   $arguments[button][back][value] = "Cancel";
                   $arguments[button][back][accesskey] = "r";
                   $arguments[button][back][extra] = " onclick=\"history.back(1)\" ";
				  }

               } 

               if ($arguments[nextpage]==1) {

                   $arguments[button][nextpage][type] = "submit";
                   $arguments[button][nextpage][name] = "nextpage";
                   $arguments[button][nextpage][value] = "next-->";
                   $arguments[button][nextpage][accesskey] = "n";

               }


               if (empty($arguments[colspan])) {
                   $arguments[colspan] = 2;
               }



             if ($arguments[confirm]==2) {
                   $arguments[button][submit][type] = "submit";
                   $arguments[button][submit][name] = "submit";
                   $arguments[button][submit][value] = "Yes";
                   $arguments[button][submit][accesskey] = "y";
                   $arguments[button][back][type] = "button";
                   $arguments[button][back][value] = "No";
                   $arguments[button][back][accesskey] = "r";
                   $arguments[button][back][extra] = " onclick=\"history.back(1)\" ";
               } 
               //echo "<pre>";
               //print_r($arguments);
               //echo "</pre>";
               echo "<td colspan=\"$arguments[colspan]\" align=\"center\">\n";
               if (isset($arguments) AND is_array($arguments)) {
                   foreach ($arguments[button] AS $k=>$button) {
                            if (empty($button[type])) {
                                $button[type] = "submit";
                            }
                            echo " <input class=\"bginput button-secondary\" accesskey=\"$button[accesskey]\" type=\"$button[type]\" name=\"$button[name]\" value=\" $button[value] \" $button[extra]> \n";
                   }
               }
               echo "</td>
                     </tr>\n";
               echo "</table>\n";
			   echo "</form>\n";

      }

      function tableheader() {
               echo "<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tableoutline\">\n";
      }

      function noformfooter() {
               echo "<tr class=\"tbhead\"><td colspan=\"2\" align=\"center\"><input class=\"bginput\" type=\"button\" value=\"Back\" onclick=\"history.go(-1);\"></td></tr></table>\n";
      }
	   function tablefooter() {
               echo "</table>\n";
      }

      function tableseparate() {

               $this->tablefooter();
               echo "<br>\n";
               $this->tableheader();

      }

      function makecategory($arguments = array()) {

               if (!is_array($arguments)) {
                   $title = $arguments;
               } else {
                   $title = $arguments[title];
               }
               if ($arguments[separate]==1) {
                   $this->tableseparate();
               }

               echo "<tr class=\"tbcat\" id=\"cat\">
                       <td colspan=\"2\">".htmlspecialchars($title)."</td>
                     </tr>\n";

      }

      function maketd($arguments = array()) {

               echo "<tr ".$this->getrowbg()." nowrap>";
               foreach ($arguments AS $k=>$v) {
                        echo "<td>$v</td>";
               }
               echo "</tr>\n";

      }

      function makeinput($arguments = array(),$other='') {


               if($other!=''){
			       $align = " align =".$other;
			   }
               if (empty($arguments[size])) {
                   $arguments[size] = 35;
               }
               if (empty($arguments[maxlength])) {
                   $arguments[maxlength] = 50;
               }
               if ($arguments[html]) {
                   $arguments[value] = htmlspecialchars($arguments[value]);
               }
               if (!empty($arguments[css])) {
                   $class = "class=\"$arguments[css]\"";
               }

               if (empty($arguments[type])) {
                   $arguments[type] = "text";
               }
               echo "<tr ".$this->getrowbg()." nowrap>
                      <td width=\"20%\" $align><b>$arguments[text]</b></td>
                       <td>
                         <input $class type=\"$arguments[type]\" name=\"$arguments[name]\" size=\"$arguments[size]\" maxlength=\"$arguments[maxlength]\" value=\"$arguments[value]\" $arguments[extra]>\n
                       </td>
                     </tr>\n";

      }

      function makecolorinput($arguments = array()) {

               if (empty($arguments[size])) {
                   $arguments[size] = 35;
               }
               if (empty($arguments[maxlength])) {
                   $arguments[maxlength] = 50;
               }
               if (empty($arguments[nohtml])) {
                   $arguments[value] = htmlspecialchars($arguments[value]);
               }
               if (!empty($arguments[css])) {
                   $class = "class=\"$arguments[css]\"";
               }
               $arguments[size] = "7";
               $arguments[maxlength] = "7";
                                                                    //this.form.$arguments[name].style.backgroundColor=this.value;
               echo "<tr ".$this->getrowbg()." nowrap>
                      <td width=\"50%\">$arguments[text]</td>
                       <td>
                         <input onchange=\"this.style.backgroundColor=this.value;\" $class type=\"text\" name=\"$arguments[name]\" size=\"$arguments[size]\" maxlength=\"$arguments[maxlength]\" value=\"$arguments[value]\">\n
                         <input style=\"background-color:$arguments[value];\" name=\"$arguments[name]\" type=\"button\"  value=\"          \" disable>
                       </td>
                     </tr>\n";

      }

     

      function inithtmlarea() {
			?>
			<script language="Javascript1.2">
			<!-- // load htmlarea
			_editor_url = "../htmlarea/";                     // URL to htmlarea files
			var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
			if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
			if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
			if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
			if (win_ie_ver >= 5.5) {
			 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
			 document.write(' language="Javascript1.2"></scr' + 'ipt>');
			} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
			// -->
			</script>
			<?php
      }
      function makehtmlarea($arguments = array()) {

               $this->maketextarea(array('text'=>$arguments[text],
                                         'name'=>$arguments[name],
                                         'value'=>$arguments[value],
                                         'html'=>1,
                                         'cols'=>100,
                                         'rows'=>20
                                         ));
               if (empty($arguments[width])) {
                   $arguments[width] = 500;
               }
               if (empty($arguments[height])) {
                   $arguments[height] = 250;
               }

?>
		<script language="JavaScript1.2" defer>
		var config = new Object(); // create new config object

		config.width = "<?php echo $arguments[width];?>";
		config.height = "<?php echo $arguments[height];?>";

		config.debug = 0;

		editor_generate('<?php echo $arguments[name];?>',config);

		</script>
<?php

      }

      function makeorderinput($arguments = array()) {

               if (empty($arguments[text])) {
                   $arguments[text] = "Sort:";
               }
               if (empty($arguments[name])) {
                   $arguments[name] = "displayorder";
               }

               $this->makeinput(array('text'=>$arguments[text],
                                      'name'=>$arguments[name],
                                      'value'=>$arguments[value],
                                      'size'=>3,
                                      'maxlength'=>3
                                      ));

      }

      function makeyesno($arguments = array()) {

               $arguments[option] = array('1'=>'Yes','0'=>'No');
               $this->makeselect($arguments);

      }
      function makesex($arguments = array()) {

               $arguments[option] = array('male'=>'Male','female'=>'Female');
               $this->makeselect($arguments);

      }


      function getstyles($arguments = array()) {

               global $DB,$db_prefix,$debug;

               if ($debug) {
                   $option[-1] = "Global Style";
               }

               $styles = $DB->query("SELECT * FROM ".$db_prefix."style ORDER BY styleid");
               while ($style = $DB->fetch_array($styles)) {
                      $option[$style[styleid]] = $style[title];
               }
               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));

      }

      function getstylefiles($arguments = array()) {
               if ($handle = opendir("./style")) {
                   while (false !== ($file = readdir($handle))) {
                          if ($file != "." && $file != ".." && ereg(".style",$file)) {
                              $option[$file] = $file;
                          }
                   }
               closedir($handle);
               }
               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));
      }

      function gettemplatesets($arguments = array()) {

               global $DB,$db_prefix,$debug;
               if ($debug) {
                   $option[-1] = "Global Templateset";
               }

               $templatesets = $DB->query("SELECT * FROM ".$db_prefix."templateset ORDER BY templatesetid");
               while ($templateset = $DB->fetch_array($templatesets)) {
                      $option[$templateset[templatesetid]] = $templateset[title];
               }
               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));
      }

      function getreplacementsets($arguments = array()) {

               global $DB,$db_prefix,$debug;
               if ($debug) {
                   $option[-1] = "Global Replacementset";
               }
               $replacements = $DB->query("SELECT * FROM ".$db_prefix."replacementset ORDER BY replacementsetid");
               while ($replacement = $DB->fetch_array($replacements)){
                      $option[$replacement[replacementsetid]] = $replacement[title];
               }
               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));

      }

      function getsettinggroups($arguments = array()) {

               global $DB,$db_prefix;
               $settinggroups = $DB->query("SELECT * FROM ".$db_prefix."settinggroup ORDER BY displayorder");
               while ($settinggroup = $DB->fetch_array($settinggroups)){
                      $option[$settinggroup[settinggroupid]] = $settinggroup[title];
               }
               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));

      }

      function makehidden($arguments = array()){

               echo "<input type=\"hidden\" name=\"$arguments[name]\" value=\"$arguments[value]\">\n";

      }

      function makelink($arguments = array()) {

               if (empty($arguments[target])) {
                   $target = "";
               } else {
                   $target = " target=\"$arguments[target]\" ";
               }
               echo "<a href=\"$arguments[url]\"$target$argument[extra]>$text</a>\n";

      }

      function getrowbg() {

               global $bgcounter;
              // if ($bgcounter++%2==0) {
                   return "class=\"firstalt\"";
              // } else {
               //    return "class=\"secondalt\"";
             //  }

      }

      function getusergroups($arguments = array()) {

               global $DB,$db_prefix;

               if (!empty($arguments[extra])) {
                   foreach ($arguments[extra] AS $key=>$value) {
                            $option[$key] = $value;
                   }
               }
               $usergroups = $DB->query("SELECT * FROM ".$db_prefix."usergroup ORDER BY usergroupid,binary title");
               while ($usergroup = $DB->fetch_array($usergroups)) {
                      $option[$usergroup[usergroupid]] = $usergroup[title];
               }

               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));

      }
      /*
      */
      var $cachesorts = array();

      function cachesorts() {

               global $DB,$db_prefix;
               $sorts = $DB->query("SELECT * FROM ".$db_prefix."sort ORDER BY displayorder,binary title,sortid ASC");
               while ($sort = $DB->fetch_array($sorts)) {
                      $this->cachesorts[$sort[parentid]][$sort[sortid]] = $sort;
               }
               $DB->free_result($sorts);
               return true;

      }


      var $option = array();
      var $css = array();

      function getsortlistbit($sortid="-1",$level=1) {

               if (isset($this->cachesorts[$sortid])) {
                   foreach($this->cachesorts[$sortid] AS $key => $sort){
                           if ($level==1) {
                               $this->css[$sort[sortid]] = "option_sort";
                           }
                           if (!isset($this->filter[$key])) {
                               $this->option[$sort[sortid]] = str_repeat("--",$level-1)." $sort[title]";
                           }
                           $this->getsortlistbit($sort[sortid],$level+1);
                   }
               }

      }

   

      var $filter = array();
      function getsortlist($arguments = array()) {

               if (empty($this->cachesorts)) {
                   $this->cachesorts();
               }

               if (!empty($arguments[extra])) {
                   foreach ($arguments[extra] AS $key=>$value) {
                            $this->option[$key] = $value;
                   }
               }
               if (!empty($arguments[filter])) {
                   $this->filter = $arguments[filter];
               }


               $this->getsortlistbit();
               //echo "<pre>";
               //print_r($this->option);
               //echo "</pre>";

               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$this->option,
                                       'css'=>$this->css));


      }

      function getmanagers($arguments = array()) {

               global $DB,$db_prefix;
               $managers = $DB->query("SELECT manager.managerid,user.username,user.userid FROM ".$db_prefix."manager as manager
                                          LEFT JOIN ".$db_prefix."user as user
                                          on manager.userid=user.userid
                                          WHERE manager.sortid='$arguments[sortid]'");
               if ($DB->num_rows($managers)==0) {
                   $option[0] = "该分类还没有任何管理员";
               } else {
                   while ($manager = $DB->fetch_array($managers)) {
                          $option[$manager[managerid]] = $manager[username];
                   }
               }

               $this->makeselect(array('text'=>$arguments[text],
                                       'name'=>$arguments[name],
                                       'selected'=>$arguments[selected],
                                       'option'=>$option));
      }

   
      function makefck($arguments = array()) {

					
			 echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
			  <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
			 <td width=\"30%\"  align =\"left\">$arguments[text]</td>
			 <td>";
              $oFCKeditor = new FCKeditor($arguments[name]) ;
			  $oFCKeditor->BasePath	= "../FCKeditor/" ;
			  $oFCKeditor->Value = $arguments[value] ;
			  $oFCKeditor->Width = ($arguments[width]=='')?600:$arguments[width];
			  $oFCKeditor->Height = ($arguments[height]=='')?300:$arguments[height];
              $oFCKeditor->Create();
              echo "<td></td>
						</table></td>
                   </tr>\n";
		}

	  function gethightext($arguments = array()){
		   if($arguments[only]=="1"){
		       $hotonly = "<font color=red>*</font>";
		   }
		   if($arguments[read]=="1"){
		      $read  = " readonly ";
		   }
		   $inputext   = $arguments[text];
		   $inputype   = $arguments[type];
		   $inputname  = $arguments[name];
		   $inputvalue = $arguments[value];
		   $inputsize  = $arguments[size];
		   $inputmax   = $arguments[max];
		   $inputprev  = $arguments[prev];
		   $inputnext  = $arguments[next];

		   if(empty($arguments[type])){
		      $inputype = "text";
		   }
		   if(empty($arguments[size])){
		      $inputsize = "40";
		   }
		   if(empty($arguments[max])){
		      $inputmax  = "200";
		   }
          if(!$arguments[view]){
		   echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\" >
                         $inputprev<input  type=\"$inputype\" name=\"$inputname\" size=\"$inputsize\" maxlength=\"$inputmax\" value=\"$inputvalue\"  $read >$inputnext
						</td><td></td>
						</table></td>
                   </tr>\n";
		  }else{
		   echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td  width=\"70%\">$inputprev ";
            if($inputprev){ echo number_format($inputvalue);}else{echo $inputvalue;}
			echo			"</td><td></td>
						</table></td>
                   </tr>\n";
		  
		  }
	  }
	  function gethighradio($arguments = array()){
		   if($arguments[only]=="1"){
		       $hotonly = "<font color=red>*</font>";
		   }
           $inputype  = "radio";
		   $inputext  = $arguments[text];
		   $inputname = $arguments[name];
           if(empty($arguments[options])){
		      $arguments[options] = array('1'=>"Yes",'0'=>"No");
		   }
		   if(!$arguments[view]){
	        echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\" >";
		     foreach($arguments[options] as $key=>$value){
				    // echo $key;
				       if($arguments[selected]==$key){$selected = " checked "; }else{$selected = '';}
                      echo  "<input  type=\"$inputype\" name=\"$inputname\"  value=\"$key\" $selected>&nbsp;$value&nbsp;";
			 }

			echo "</td><td></td>
						</table></td>
                   </tr>\n";
		   }else{
		  if($arguments[selected]=="0"){$value="NO";}else{$value="Yes";}
		   echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\">$value</td><td></td>
						</table></td>
                   </tr>\n";
		   }
	  }
	  function maketextarea($arguments = array()){
              if($arguments[only]=="1"){
		       $hotonly = "<font color=red>*</font>";
		       }
               if (empty($arguments[cols])) {
                   $arguments[cols] = 40;
               }
               if (empty($arguments[rows])) {
                   $arguments[rows] = 7;
               }
               if (!empty($arguments[html])) {
                   $arguments[value] = htmlspecialchars($arguments[value]);
               }
               if(!$arguments[view]){
					 echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
						   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
							 <td width=\"30%\" valign=\"top\"><b>$arguments[text]</b>$hotonly</td>
							 <td width=\"70%\">
							   <textarea type=\"text\" name=\"$arguments[name]\" cols=\"$arguments[cols]\" rows=\"$arguments[rows]\" $arguments[extra]>$arguments[value]</textarea>
							 </td><td></td>
							</table></td>
					   </tr>\n";
			   }else{
			    echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
						   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
							 <td width=\"30%\" valign=\"top\"><b>$arguments[text]</b>$hotonly</td>
							 <td width=\"70%\">
							   $arguments[value]
							 </td><td></td>
							</table></td>
					   </tr>\n";
			   }

      }
	  function makeselect($arguments = array()){
		      global $country,$state,$jobcategory,$education,$jobfunction,$yearexp,$jobtype,$jobstatus,$appstatus,$feedback,$salary,$service,$orderby,$utype,$jobfillstatus,$location,$travel;
			   if($arguments[only]=="1"){
				   $hotonly = "<font color=red>*</font>";
			   }
               if ($arguments[html]==1) {
                   $value = htmlspecialchars($value);
               }
               $size = "size=$arguments[size]";
               if(!$arguments[view]){
					   echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
							   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
								 <td width=\"30%\" valign=\"top\"><b>$arguments[text]</b>$hotonly</td>
								 <td width=\"70%\">
							  <select name=\"$arguments[name]\" $size>\n";
					   if (is_array($arguments[option])) {

						   foreach ($arguments[option] AS $key=>$value) {
									if (!is_array($arguments[selected])) {
										if ($arguments[selected]==$key) {
											echo "<option value=\"$key\" selected class=\"{$arguments[css][$key]}\">$value</option>\n";
										} else {
											echo "<option value=\"$key\" class=\"{$arguments[css][$key]}\">$value</option>\n";
										}

									} elseif (is_array($arguments[selected])) {

										if ($arguments[selected]["$key"]==1) {
											echo "<option value=\"$key\" selected class=\"{$arguments[css][$key]}\">$value</option>\n";
										} else {
											echo "<option value=\"$key\" class=\"{$arguments[css][$key]}\">$value</option>\n";
										}
									}
						   }
					   }

					   echo "</select>\n";
					   echo "</td><td></td>
								</table></td>
						   </tr>\n";
			   }else{
				  $argarr =  $arguments[option];
			       echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$arguments[text]:</b>$hotonly</td>
                       <td width=\"70%\">".$argarr[$arguments[selected]]."</td><td></td>
						</table></td>
                   </tr>\n";
			   
			   }

      }
	   function makefile($arguments = array()) {
               if($arguments[only]=="1"){
				  $hotonly = "<font color=red>*</font>";
		       }
			   if(!$arguments[url]){
			     $arguments[url] = "uploadfiles/";
			   }
			   if($arguments[value]){
			      $imgurl  = '<a href="../'.$arguments[url].$arguments[value].'" target="_blank">[view image file]</a>';
			   }
			   if(!$arguments[view]){
                 echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
						 <td width=\"30%\" valign=\"top\"><b>$arguments[text]</b>$hotonly</td>
						 <td width=\"70%\">
                         <input type=\"file\" name=\"$arguments[name]\" $arguments[extra]>$imgurl\n
                       </td><td></td>
						</table></td>
                   </tr>\n";
			   }else{
			     echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
						 <td width=\"30%\" valign=\"top\"><b>$arguments[text]</b>$hotonly</td>
						 <td width=\"70%\"> $imgurl
                       </td><td></td>
						</table></td>
                   </tr>\n";
			   }
      }
      function getinstant($arguments = array()){
		    global $instants;
		    if($arguments[only]=="1"){
				  $hotonly = "<font color=red>*</font>";
		     }
            $inputext  = $arguments[text];
			$instantid = $arguments[value2];

			//echo $arguments[value1];
			if(!$arguments[view]){
	        echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\"><select name=\"instantype\">";
					  foreach($instants as $key=>$value){
						  if($arguments[value1]==$key){$selected = " selected ";}else{$selected = "";}
						  echo 	"<option value=\"$key\" $selected>$value</option>";
					  }
			echo  "</select>&nbsp;<input  type=\"text\" name=\"instantid\" value=\"$instantid\" size=\"27\"></td>
					   <td></td>
					   </table></td>
                  </tr>\n";
			}else{
			 echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\">$arguments[value1]&nbsp;$arguments[value2]</td>
					   <td></td>
					   </table></td>
                  </tr>\n";
			}
	  }

	  function getbox($arguments = array()){
		   if($arguments[only]=="1"){
		       $hotonly = "<font color=red>*</font>";
		   }
		   $inputext  = $arguments[text];
		   $inputname = $arguments[name];
		   if($arguments[value]==1) $check = " checked ";
		   if(!$arguments[view]){
	        echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\" ><input type=\"checkbox\" name=\"$inputname\" value=\"1\" $check></td><td></td>
						</table></td>
                   </tr>\n";
		   }else{
		  if($arguments[value]!="1"){$value="unChecked";}else{$value="Checked";}
		   echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\">$value</td><td></td>
						</table></td>
                   </tr>\n";
		   }
	  }
	  
	  function getBoxes($arguments = array()){
		   if($arguments[only]=="1"){
		       $hotonly = "<font color=red>*</font>";
		   }
		   $inputext  = $arguments[text];
		   $inputname = $arguments[name];
		   if(!$arguments[view]){
	        echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
						<tr>
							<td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
							<td width=\"70%\" >";
			foreach($arguments["option"] as $key => $value){
				$check = (@in_array($key, $arguments["selected"]))?"checked":"";
			  echo "<input type=\"checkbox\" name=\"$inputname\" value=\"".$key."\" $check>".$value."&nbsp;";
			}
		  echo "				</td>
						</tr>
					</table></td>
                   </tr>\n";
		   }else{
	        echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
						<tr>
							<td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
							<td width=\"70%\" >";
			foreach($arguments["option"] as $key => $value){
				if(@in_array($key, $arguments["selected"])){
			  		echo $value;
			  		if(sizeof($arguments["option"]) != $key){
			  			echo ",";
			  		}
			  		echo "&nbsp;";
			    	}
			}
		  echo "				</td>
						</tr>
					</table></td>
                   </tr>\n";
		   }
	  }

	  function getdoubletext($arguments = array()){
		   if($arguments[only]=="1"){
		       $hotonly = "<font color=red>*</font>";
		   }
		   $inputext  = $arguments[text];
		   $value1    = $arguments[value1];
		   $value2    = $arguments[value2];
		   if(!$arguments[view]){
            echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\" ><input type=\"text\" name=\"time\" value=\"$value1\" >&nbsp;<input type=\"text\" name=\"timezone\" value=\"$value2\"></td><td></td>
						</table></td>
                   </tr>\n";
		   }else{
		   echo "<tr class=\"firstalt\" nowrap><td colspan=\"2\">
					   <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >
	                   <td width=\"30%\"  align =\"left\"><b>$inputext:</b>$hotonly</td>
                       <td width=\"70%\" >$value1 - $value2</td><td></td>
						</table></td>
                   </tr>\n";
		   }
	  }
	  function getimage($arguments = array()){
		   $url = $arguments[url];
		   $img = $arguments[img];
		   if($arguments[view]){
				   echo "<tr class=\"firstalt\" nowrap><td width=50% style=\"border:1px solid red\"></td><td rowspan=\"1\" width=50% ><div style=\"border:1px solid green;position:absolute\"><img src=\"../uploadfiles/".$url."".$img."\" style=\"width:120px;height:120px\"></div></td></tr>\n";
		   }
	  }

	function longline($arguments=array()){
	      if(!empty($arguments[icon])){
		       $icon = ' <a href="###" onmouseover="Tip('.$arguments[icon].')"><img src="images/icn_question.jpg" border="0" align="absmiddle" /></a>';
		   }
	         if ($arguments[title]!="") {
                   echo "<tr id=\"cat\">
                          <td class=\"tbhead\" colspan=\"2\">
                            <b>$arguments[title]</b>$icon
                          </td>
                         </tr>\n";
               }
	  }
	  function smallline($arguments=array()){
	      if(!empty($arguments[icon])){
		       $icon = ' <a href="###" onmouseover="Tip('.$arguments[icon].')"><img src="images/icn_question.jpg" border="0" align="absmiddle" /></a>';
		   }
	         if ($arguments[title]!="") {
                   echo "<tr>
                          <td  bgcolor=\"#F0F0F0\" colspan=\"2\">
                            <b>$arguments[title]</b>$icon
                          </td>
                         </tr>\n";
               }
	  }

}

?>